/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package merlion.scm.icm.entity;

import java.io.Serializable;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import merlion.crm.sopm.entity.ItemLine;
import merlion.mrp.pmm.entity.FinishedGood;

/**
 *
 * @author Yuwei
 */
@Entity
public class InventoryReservation implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    private Long reservationQty;
    @ManyToOne(targetEntity = FinishedGood.class, cascade = {CascadeType.MERGE}, fetch = FetchType.EAGER)
    private FinishedGood batch;
    @ManyToOne(targetEntity = ItemLine.class, cascade = {CascadeType.MERGE}, fetch = FetchType.EAGER)
    private ItemLine deliveryOrderItemLine;

    public InventoryReservation(){
        reservationQty = 0L;
        batch = new FinishedGood();
        deliveryOrderItemLine = new ItemLine();
    }
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public FinishedGood getBatch() {
        return batch;
    }

    public void setBatch(FinishedGood batch) {
        this.batch = batch;
    }

    public ItemLine getDeliveryOrderItemLine() {
        return deliveryOrderItemLine;
    }

    public void setDeliveryOrderItemLine(ItemLine deliveryOrderItemLine) {
        this.deliveryOrderItemLine = deliveryOrderItemLine;
    }

    public Long getReservationQty() {
        return reservationQty;
    }

    public void setReservationQty(Long reservationQty) {
        this.reservationQty = reservationQty;
    }
    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        if (!(object instanceof InventoryReservation)) {
            return false;
        }
        InventoryReservation other = (InventoryReservation) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "merlion.scm.icm.entity.InventoryReservation[ id=" + id + " ]";
    }
    
}
